{% extends "TestTools/base.html" %}
{% block body %}
    <script src="/static/js/bug.js"></script>
    {% if type == "new" %}
        <body onload="getnewbugelements()">
        {% if newid != 0 %}
            <div class="alert alert-success" role="alert">Bug提交成功,<a href="{% url 'bugdetail' newid %}">点击查看</a></div>
        {% endif %}

        <form class="form-horizontal" method="post" action="{% url 'newbug' 'new' 0 %}">
            {% csrf_token %}
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择项目</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Project" id="project">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入标题</label>
                <div class="col-sm-8">
                    <input class="form-control" placeholder="请输入标题" name="bugTitle">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择终端</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Terminal" id="terminal">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入缺陷描述</label>
                <div class="col-sm-8">
                <textarea class="form-control" rows="4" placeholder="请输入缺陷描述(markdown)"
                          name="bugDescription" id="bugDescription"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入重现步骤</label>
                <div class="col-sm-8">
                    <textarea class="form-control" rows="6" placeholder="请输入重现步骤(markdown)" name="bugStep"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择开发人员</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Developer" id="developer">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择测试人员</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Tester" id="tester">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择缺陷状态</label>
                <div class="col-sm-8">
                    <select class="form-control" name="bugStatus" id="bugstatus">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">提交</button>
                </div>
            </div>
        </form>
        </body>
    {% elif type == "update" %}
        <body onload="~function(){getnewbugelements();getOneBug({{ bugID }})}()">
        <form class="form-horizontal" method="post" action="{% url 'updatebug' bugID %}">
            {% csrf_token %}
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择项目</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Project" id="project">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入标题</label>
                <div class="col-sm-8">
                    <input class="form-control" placeholder="请输入标题" name="bugTitle" id="bugTitle">
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择终端</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Terminal" id="terminal">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入缺陷描述</label>
                <div class="col-sm-8">
                <textarea class="form-control" rows="4" placeholder="请输入缺陷描述(markdown)"
                          name="bugDescription" id="bugDescription"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请输入重现步骤</label>
                <div class="col-sm-8">
                    <textarea class="form-control" rows="6" placeholder="请输入重现步骤(markdown)" name="bugStep"
                              id="bugStep"></textarea>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择开发人员</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Developer" id="developer">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择测试人员</label>
                <div class="col-sm-8">
                    <select class="form-control" name="Tester" id="tester">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <label class="col-sm-2 control-label">请选择缺陷状态</label>
                <div class="col-sm-8">
                    <select class="form-control" name="bugStatus" id="bugstatus">
                    </select>
                </div>
            </div>
            <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                    <button type="submit" class="btn btn-default">提交</button>
                </div>
            </div>
        </form>
        </body>
    {% endif %}

{% endblock %}